<template>
  <div>
    <button @click="rev">浪起来</button>
    <button @click="stop">停止</button>
    <hr />
    <h1>{{ msg }}</h1>
  </div>
</template>

<script>
export default {
  name: "CF",
  components: {},
  props: {},
  data() {
    return {
      msg: "我拿Buff,谢谢~",
      timer: "",
    };
  },
  computed: {},
  watch: {},
  created() {},
  methods: {
    rev() {
      this.timer ? clearInterval(this.timer) : "";
      console.log(this.timer);
      this.timer = setInterval(() => {
        this.msg = this.msg + this.msg[0];
        this.msg = this.msg.slice(1);
      }, 500);
    },
    stop() {
      clearInterval(this.timer);
      console.log(this.timer);
    },
  },
};
</script>

<style scoped></style>
